
import {LoginModule} from "../logic/LoginModule";
import {DispatcherUtils} from "../util/DispatcherUtils";
import {Event} from "../Event";
import {Config} from "../Config";
const {ccclass, property} = cc._decorator;

@ccclass
export default class LoginUI extends cc.Component {
    @property(cc.EditBox)
    account:cc.EditBox = null;
    @property(cc.EditBox)
    password:cc.EditBox = null;

    onLoad(){
        DispatcherUtils.removeEventListenerByEvent(Event.LOGIN_SUCCESS);
        DispatcherUtils.addEventListener(Event.LOGIN_SUCCESS,function () {
            if(this.node) this.node.active = false;
        }.bind(this))
    }

    onClickLogin(){
        let account = this.account.string;
        let password = this.password.string;
        LoginModule.loginGuest(account,password);
    }
}
